Skip to content

[jsweep] Clean action_input_utils.cjs#33933

Merged
pelikhan merged 1 commit into
mainfrom
signed/jsweep/action_input_utils-731ff98d9b96545b
May 22, 2026
Merged

[jsweep] Clean action_input_utils.cjs#33933
pelikhan merged 1 commit into
mainfrom
signed/jsweep/action_input_utils-731ff98d9b96545b

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Summary

Reviewed and improved documentation for action_input_utils.cjs.

File Status

This file was already in excellent production-ready shape:

  • ✅ Modern ES6+ JavaScript with clean, readable code
  • ✅ Full TypeScript type checking enabled (@ts-check)
  • ✅ Comprehensive test coverage (13 tests, 91 lines of test code for 21 lines of source)
  • ✅ No code smells or unnecessary try/catch blocks
  • ✅ Clear, well-documented JSDoc comments

Changes Made

Enhanced JSDoc documentation to explicitly document precedence behavior:

  • Added clarification that the underscore form (INPUT_<NAME>) has precedence over the hyphen form (INPUT_<NAM-E>)
  • Documented that the hyphen form is only checked if the underscore form is absent or empty string
  • This behavior was already thoroughly tested but not explicitly documented

Context

Execution context: Node.js / GitHub Actions runtime
Test coverage: 13 test cases covering:

  • Underscore form behavior (4 tests)
  • Hyphen form behavior (2 tests)
  • Precedence rules (2 tests)
  • Absent variables (2 tests)
  • Input name variations (3 tests)

Validation Results

All validation checks passed:

Formatting: npm run format:cjs - passed (no changes needed)
Linting: npm run lint:cjs - passed (no issues)
Type checking: npm run typecheck - passed (strict type safety)
Tests: npm run test:js - 13/13 tests passed (100%)

Impact

This is a documentation-only improvement. No functional changes to the code.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • traces.example.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "traces.example.com"

See Network Configuration for more information.

Generated by 🧹 jsweep - JavaScript Unbloater · ● 1M ·

  • expires on May 24, 2026, 5:04 AM UTC

Improved JSDoc to explicitly document that the underscore form has
precedence over the hyphen form, clarifying the OR chain behavior
that the existing tests already verify.

File was already in excellent shape:
- Modern ES6+ JavaScript
- Full TypeScript type checking enabled (@ts-check)
- Comprehensive test coverage (13 tests covering all edge cases)
- No code smells or unnecessary try/catch blocks

Changes:
- Enhanced JSDoc documentation for precedence behavior

Validation:
✅ npm run format:cjs - passed
✅ npm run lint:cjs - passed
✅ npm run typecheck - passed
✅ npm run test:js - 13/13 tests passed

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review May 22, 2026 05:20
Copilot AI review requested due to automatic review settings May 22, 2026 05:20
@pelikhan pelikhan merged commit 5e917f7 into main May 22, 2026
9 of 10 checks passed
@github-actions
Copy link
Copy Markdown
Contributor Author

github-actions Bot commented May 22, 2026

Design Decision Gate 🏗️ completed the design decision gate check.

No ADR enforcement needed: PR #33933 does not have the 'implementation' label and has 0 new lines of code in business logic directories (well below the 100-line threshold).

@github-actions
Copy link
Copy Markdown
Contributor Author

github-actions Bot commented May 22, 2026

🧪 Test Quality Sentinel completed test quality analysis.

No test files were added or modified in PR #33933. The PR only modified actions/setup/js/action_input_utils.cjs (a production file). Test Quality Sentinel analysis skipped.

@github-actions
Copy link
Copy Markdown
Contributor Author

github-actions Bot commented May 22, 2026

PR Code Quality Reviewer completed the code quality review.

No action needed: PR #33933 is already merged and closed (merged at 2026-05-22T05:20:17Z). Cannot add review comments to closed PRs. The PR added documentation claiming whitespace-only INPUT values have precedence, but this is technically inaccurate: empty string INPUT values (falsy) fall through to the hyphen form, while whitespace-only values (truthy) are used but then trimmed to empty string. However, since the PR is merged, no review action can be taken.

@github-actions
Copy link
Copy Markdown
Contributor Author

github-actions Bot commented May 22, 2026

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the JSDoc for getActionInput() to explicitly document the existing precedence rules between underscore and hyphen GitHub Actions input environment variable forms.

Changes:

  • Documented that INPUT_<NAME> (underscore form) takes precedence over INPUT_<NAM-E> (hyphen form), including the whitespace-only behavior.
  • Clarified that the hyphen form is only consulted when the underscore form is absent or an empty string.
Show a summary per file
File Description
actions/setup/js/action_input_utils.cjs JSDoc clarification of underscore-vs-hyphen env var precedence for action inputs

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

@github-actions github-actions Bot mentioned this pull request May 22, 2026
Copy link
Copy Markdown
Contributor Author

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skills-Based Review 🧠

Applied /grill-with-docs — requesting changes due to documentation inaccuracy.

📋 Key Finding

Critical Issue

Documentation contradicts implementation and test suite

The new JSDoc claims that the hyphen form is checked "if the underscore form is absent or empty string," but this is incorrect. The implementation uses JavaScript's || operator, which means:

  • ✅ Empty string "" → falls back to hyphen form (truthy check fails)
  • ❌ Whitespace " " → does NOT fall back (truthy, so || short-circuits)

The test suite explicitly documents this edge case at line 30–36:

it("does not fall back to hyphen form when underscore form is whitespace-only (whitespace is truthy)", ...)

Why This Matters

Documentation that contradicts the code creates confusion and maintenance debt. Future developers might:

  1. Trust the docs and be surprised by whitespace behavior
  2. "Fix" the code to match the docs, breaking existing workflows
  3. Waste time debugging why their inputs don't work as documented
✅ Positive Highlights
  • Excellent test coverage (13 tests for a 3-line function)
  • Test names read as specifications — very clear intent
  • Good motivation for adding the documentation (behavior was implicit)

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · ● 517.5K

* both forms ensures the value is resolved regardless of the runner version.
*
* The underscore form has precedence: if `INPUT_<NAME>` exists (even as whitespace),
* it is used. The hyphen form is only checked if the underscore form is absent or
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/grill-with-docs] Documentation inaccuracy: whitespace-only values do NOT fall back to hyphen form.

❌ The issue

The new documentation states:

The underscore form has precedence: if INPUT_<NAME> exists (even as whitespace), it is used. The hyphen form is only checked if the underscore form is absent or empty string.

This contradicts the actual behavior. Whitespace-only values are truthy, so the || operator short-circuits and never checks the hyphen form. The test suite explicitly documents this:

it("does not fall back to hyphen form when underscore form is whitespace-only (whitespace is truthy)", () => {
  vi.stubEnv("INPUT_JOB_NAME", "   ");
  vi.stubEnv("INPUT_JOB-NAME", "real-value");
  expect(getActionInput("JOB_NAME")).toBe("");  // Returns "", not "real-value"
});
✅ Suggested fix

Replace lines 12–14 with:

 * The underscore form has precedence: if `INPUT_<NAME>` is truthy (including
 * whitespace-only strings), it is used and the result is trimmed. The hyphen form
 * is only checked if the underscore form is absent (undefined) or empty string ("").

Or, to match the test name more precisely:

 * Precedence: The underscore form (`INPUT_<NAME>`) is checked first using the `||`
 * operator. If it is truthy (even whitespace like `"   "`), it is used and trimmed.
 * The hyphen form is only checked if the underscore form is falsy (undefined, null, or "").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants